﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Pheonix.Fashionzoomer.BLL;
using Pheonix.CodeLibrary.Web;

public partial class control_Toolbar : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        homeIcon.ImageUrl = "~/App_Themes/" + Page.StyleSheetTheme + "/image/toolbar_03.jpg";

        if (SessionManager.IsUserLoggedIn)
            userDisplayName.Text = SessionManager.LoggedUser.FullName;
        else
            userDisplayName.Text = "Guest";

        registerIcon.ImageUrl = "~/App_Themes/" + Page.StyleSheetTheme + "/image/toolbar_05.jpg";

        loginIcon.ImageUrl = "~/App_Themes/" + Page.StyleSheetTheme + "/image/toolbar_06.jpg";

        searchText.Text = "Search";
        searchText.Attributes.Add("onclick", "javascript:this.value='';javascript:this.style.color='#cc0000';");

        doSearch.ImageUrl = "~/App_Themes/" + Page.StyleSheetTheme + "/image/toolbar_08.jpg";
    }

    protected void Search_Click(object sender, ImageClickEventArgs e)
    {
        SessionManager.SearchKeyword = searchText.Text;
        if (searchCategory.SelectedValue == "product")
            Response.Redirect("~/public/productlist.aspx");
        else if (searchCategory.SelectedValue == "shop")
            Response.Redirect("~/public/shoplist.aspx");
        else if (searchCategory.SelectedValue == "article")
            Response.Redirect("~/public/articlelist.aspx");
    }
}
